Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Bing/ChatGPT4 wrote code today ... im/de/pressive !

Bing/ChatGPT4 wrote code today ... im/de/pressive !

Scheduled Pinned Locked Moved The Lounge
csharpadobesysadmin
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BillWoodruff
    wrote on last edited by
    #1

    I drank the Kool-Aid: it tasted like the refrigerated air in gigantic server farms with top-notes of ozone and mass-layoff sweat.

    Quote:

    To determine if a circle is in an ellipse in C#, you can use the following code: public bool IsCircleInEllipse(RectangleF ellipseBounds, PointF circleCenter, float circleRadius) { var xRadius = ellipseBounds.Width / 2; var yRadius = ellipseBounds.Height / 2; var xCenter = ellipseBounds.X + xRadius; var yCenter = ellipseBounds.Y + yRadius; var dx = Math.Abs(circleCenter.X - xCenter); var dy = Math.Abs(circleCenter.Y - yCenter); if (dx > xRadius || dy > yRadius) return false; if (dx <= xRadius - circleRadius && dy <= yRadius - circleRadius) return true; var xCornerDist = dx - xRadius; var yCornerDist = dy - yRadius; var cornerDistSq = xCornerDist * xCornerDist + yCornerDist * yCornerDist; return cornerDistSq <= circleRadius * circleRadius; } This code checks if the circle is completely inside the ellipse. If you want to check if the circle is partially inside the ellipse, you can modify the code accordingly. I hope this helps! Let me know if you have any other questions. Source: Conversation with Bing, 6/19/2023

    p.s. none of the "relevant" links to published code examples included in the response were to articles with a solution to determining if a circle was fully contained in an ellipse.

    «The mind is not a vessel to be filled but a fire to be kindled» Plutarch

    M 1 Reply Last reply
    0
    • B BillWoodruff

      I drank the Kool-Aid: it tasted like the refrigerated air in gigantic server farms with top-notes of ozone and mass-layoff sweat.

      Quote:

      To determine if a circle is in an ellipse in C#, you can use the following code: public bool IsCircleInEllipse(RectangleF ellipseBounds, PointF circleCenter, float circleRadius) { var xRadius = ellipseBounds.Width / 2; var yRadius = ellipseBounds.Height / 2; var xCenter = ellipseBounds.X + xRadius; var yCenter = ellipseBounds.Y + yRadius; var dx = Math.Abs(circleCenter.X - xCenter); var dy = Math.Abs(circleCenter.Y - yCenter); if (dx > xRadius || dy > yRadius) return false; if (dx <= xRadius - circleRadius && dy <= yRadius - circleRadius) return true; var xCornerDist = dx - xRadius; var yCornerDist = dy - yRadius; var cornerDistSq = xCornerDist * xCornerDist + yCornerDist * yCornerDist; return cornerDistSq <= circleRadius * circleRadius; } This code checks if the circle is completely inside the ellipse. If you want to check if the circle is partially inside the ellipse, you can modify the code accordingly. I hope this helps! Let me know if you have any other questions. Source: Conversation with Bing, 6/19/2023

      p.s. none of the "relevant" links to published code examples included in the response were to articles with a solution to determining if a circle was fully contained in an ellipse.

      «The mind is not a vessel to be filled but a fire to be kindled» Plutarch

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      I give that code a C-. Multiple return points, the two if statements should really have braces and composed as if-else-else with a "ret" variable so there's only one exit to the function, at the end! And a return with a conditional and computation in it just sucks, as it makes it more difficult to debug. Otherwise, the variable naming is good, and I wonder where it stole the code from. :laugh: And your p.s. is quite amusing, so much for the AI accurately referencing its sources.

      Latest Articles:
      A Lightweight Thread Safe In-Memory Keyed Generic Cache Collection Service A Dynamic Where Implementation for Entity Framework

      L B 2 Replies Last reply
      0
      • M Marc Clifton

        I give that code a C-. Multiple return points, the two if statements should really have braces and composed as if-else-else with a "ret" variable so there's only one exit to the function, at the end! And a return with a conditional and computation in it just sucks, as it makes it more difficult to debug. Otherwise, the variable naming is good, and I wonder where it stole the code from. :laugh: And your p.s. is quite amusing, so much for the AI accurately referencing its sources.

        Latest Articles:
        A Lightweight Thread Safe In-Memory Keyed Generic Cache Collection Service A Dynamic Where Implementation for Entity Framework

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        It also assumes one knows how to get the "bounding rectangle" for an ellipse in the first place. Yeah ... I also think the code is "lifted".

        "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

        1 Reply Last reply
        0
        • M Marc Clifton

          I give that code a C-. Multiple return points, the two if statements should really have braces and composed as if-else-else with a "ret" variable so there's only one exit to the function, at the end! And a return with a conditional and computation in it just sucks, as it makes it more difficult to debug. Otherwise, the variable naming is good, and I wonder where it stole the code from. :laugh: And your p.s. is quite amusing, so much for the AI accurately referencing its sources.

          Latest Articles:
          A Lightweight Thread Safe In-Memory Keyed Generic Cache Collection Service A Dynamic Where Implementation for Entity Framework

          B Offline
          B Offline
          BillWoodruff
          wrote on last edited by
          #4

          @marc-clifton My sources at OpenAI and MS/Bing tell me that the effort to get generated code in C# optionally written in the flavor called "High Cliftonian" has been postponed again until at least spring 2024. cheers, bill

          «The mind is not a vessel to be filled but a fire to be kindled» Plutarch

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups