Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6945225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:24:32+00:00 2026-05-27T13:24:32+00:00

I want to include the some region plots in a Manipulate structure, however the

  • 0

I want to include the some region plots in a Manipulate structure, however the rendering is almost prohibitively slow. The code is

ClearAll[regions, rplot]
r:regions[n_Integer, o_Integer] := r = Apply[And, 
    Subsets[Table[(#1 - Cos[t])^2 + (#2 - Sin[t])^2 <= 1, {t, 2 Pi/n, 
       2 Pi, 2 Pi/n}], {o}], {1}] &
r:rplot[n_Integer, o_Integer] := r = Show[{RegionPlot[
     Evaluate[regions[n, o][x, y]], {x, -2, 2}, {y, -2, 2},
     PlotRange -> {{-2, 2}, {-2, 2}}, PlotRangePadding -> .1, 
     Frame -> False, PlotPoints -> 100], 
    Graphics[Table[Circle[{Cos[t], Sin[t]}, 1], {t, 2 Pi/n, 2 Pi, 2 Pi/n}]]}]

Which produces graphics like

GraphicsGrid[{{rplot[3, 2], rplot[5, 3]}, {rplot[7, 2], rplot[4, 1]}}]

circles from above!

The above takes about 40 seconds to calculate and render on my computer.
Can anyone suggest a way to get similar quality graphics more quickly?


Note 1: I’ve memoized the graphics object so that doesn’t need to recalculate it each time in my demonstration – but it’s too slow even the first time.
Note 2: I’m happy with rasterized images, so maybe a flood fill type solution would be an option…
Note 3: I need something like Manipulate[
rplot[n, o], {n, 2, 10, 1, Appearance -> "Labeled"}, {{o, 1},
Range[1, (n + 1)/2], ControlType -> RadioButtonBar}]
to be usable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:24:32+00:00Added an answer on May 27, 2026 at 1:24 pm

    I previously posted this as an addition to my other answer. It’s inspired by Simon’s analytic approach, with some modifications to speed things up

    intersect[n_, o_] :=
      With[{a = Pi/2 - (o-1) Pi/n},
       If[o-1 >= n/2, Return[{}]]; (* intersection is {} *)
       Polygon[
        Join[Table[{Sin[a] + Sin[phi], (-Cos[a] + Cos[phi])}, {phi, -a, a-2 a/10, 2 a/10}], 
         Table[{Sin[a] + Sin[phi], (Cos[a] - Cos[phi])}, {phi, a, -a+2 a/10, -2 a/10}]]]]
    
    rplot2[n_, o_] := With[{pl = intersect[n, o], opac = .3, col = ColorData[1]},
      Graphics[{{Opacity[opac], 
         Table[{col[k], Rotate[pl, Mod[o - 1, 2] Pi/n + 2 Pi k/n, {0, 0}]}, {k, n}]},
        {Black, Circle[Through[{Re, Im}[Exp[I #]]]] & /@ (Range[n] 2 Pi/n)}}]
     ]
    

    First of all, I’m using that for given value of n and o, the intersection region between the i-th and i+o-1-th circle is the same as the intersection region between the first and o-th circle except for a rotation over an angle 2 Pi (i-1)/n, so it suffices to calculate the region once and use Rotate to rotate the region.

    Also, instead of using a ParametricPlot to plot the intersection region, I’m using a Polygon so I only need to calculate some points on the boundary which saves time.

    The result for GraphicsGrid[{{rplot2[3, 2], rplot2[5, 2]}, {rplot2[7, 3], rplot2[4, 1]}}] looks like

    Intersecting circles revisited

    And the timings I get are

    rplot2[10, 3]; // Timing
    
    (* ==> {0.0016, Null} *)
    

    compared to those for Simon’s solution

    rplot[10, 3]; // Timing
    
    (* ==> {0.16519, Null} *)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to include some dynamic part in the filename of the msi file
I want to include some HTML in the labels of the radio buttons so
I want to find a method to include some files based on the current
I want to cat all the files in a directory, but include some spacer
I am extending FPDF and want to include some external variables but it's not
I am writing a system monitor for Linux and want to include some watchdog
I want to include some sort of performance counts in my application. Are Windows
I am planing to make an app for iPhone I want to include some
I want to include some files in my WAR that the classes can get
i want to custom view,it can include some effect:first draw a pic on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.